package com.lianzhihui.romeex.ui.me.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.config.AppConstants;
import com.lianzhihui.romeex.config.MessageEvent;
import com.lianzhihui.romeex.ui.MainActivity;
import com.lianzhihui.romeex.ui.base.ActivityManager;
import com.lianzhihui.romeex.ui.base.BaseDialog;
import com.lianzhihui.romeex.utils.LanguageUtil;
import com.lianzhihui.romeex.utils.LogUtil;
import com.lianzhihui.romeex.utils.NoDoubleClickUtils;
import com.lianzhihui.romeex.utils.PreferenceUtils;

import org.greenrobot.eventbus.EventBus;

import java.util.Locale;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.me.dialog
 * @ClassName: UpDateVersionDialog
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/11/3 10:40
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/11/3 10:40
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class LanguageChoseDialog extends BaseDialog {


    //    @BindView(R.id.tv_follow_system)
//    TextView tvFollowSystem;
    @BindView(R.id.tv_simple_chinese)
    TextView tvSimpleChinese;
    @BindView(R.id.tv_english)
    TextView tvEnglish;
    @BindView(R.id.tv_cancel)
    TextView tvCancel;

    public LanguageChoseDialog(@NonNull Context context) {
        super(context);
    }

    public LanguageChoseDialog(Context context, int style) {
        super(context, style);
    }

    @Override
    public void setCancelable(boolean flag) {
        super.setCancelable(flag);
    }

    @Override
    public void show() {
        super.show();
    }

    @Override
    public void dismiss() {
        super.dismiss();
    }

    @Override
    protected int provideViewId() {
        return R.layout.dialog_lanuage_change;
    }

    @Override
    protected void initView() {
    }


    @OnClick({R.id.tv_simple_chinese, R.id.tv_english, R.id.tv_cancel})
    public void OnClick(View v) {
        if (NoDoubleClickUtils.isDoubleClick()) {
            switch (v.getId()) {
//            case R.id.tv_follow_system:
//                EventBus.getDefault().post(new MessageEvent(AppConstants.Event.LANGUAGECHANGE, "follow"));
//                dismiss();
//                break;
                case R.id.tv_simple_chinese:
                    EventBus.getDefault().post(new MessageEvent(AppConstants.Event.LANGUAGECHANGE, "zh"));
                    dismiss();
                    break;
                case R.id.tv_english:
                    EventBus.getDefault().post(new MessageEvent(AppConstants.Event.LANGUAGECHANGE, "en"));
                    dismiss();
                case R.id.tv_cancel:
                    dismiss();
                    break;
                default:
                    break;
            }
        }
    }


}
